package com.ruoyi.group.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.group.mapper.MenuMapper;
import com.ruoyi.group.domain.Menu;
import com.ruoyi.group.service.IMenuService;

/**
 * 菜单Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-08
 */
@Service
public class MenuServiceImpl implements IMenuService 
{
    @Autowired(required = false)
    private MenuMapper menuMapper;

    /**
     * 查询菜单
     * 
     * @param menuId 菜单主键
     * @return 菜单
     */
    @Override
    public Menu selectMenuByMenuId(Long menuId)
    {
        return menuMapper.selectMenuByMenuId(menuId);
    }

    /**
     * 查询菜单列表
     * 
     * @param menu 菜单
     * @return 菜单
     */
    @Override
    public List<Menu> selectMenuList(Menu menu)
    {
        return menuMapper.selectMenuList(menu);
    }

    /**
     * 新增菜单
     * 
     * @param menu 菜单
     * @return 结果
     */
    @Override
    public int insertMenu(Menu menu)
    {
        menu.setCreateTime(DateUtils.getNowDate());
        return menuMapper.insertMenu(menu);
    }

    /**
     * 修改菜单
     * 
     * @param menu 菜单
     * @return 结果
     */
    @Override
    public int updateMenu(Menu menu)
    {
        menu.setUpdateTime(DateUtils.getNowDate());
        return menuMapper.updateMenu(menu);
    }

    /**
     * 批量删除菜单
     * 
     * @param menuIds 需要删除的菜单主键
     * @return 结果
     */
    @Override
    public int deleteMenuByMenuIds(Long[] menuIds)
    {
        return menuMapper.deleteMenuByMenuIds(menuIds);
    }

    /**
     * 删除菜单信息
     * 
     * @param menuId 菜单主键
     * @return 结果
     */
    @Override
    public int deleteMenuByMenuId(Long menuId)
    {
        return menuMapper.deleteMenuByMenuId(menuId);
    }
}
